{% extends "myadmin/base.html" %} {% block mainbody %}
<link rel="stylesheet" type="text/css" href="/ueditor/UE/third-party/SyntaxHighlighter/shCoreDefault.css">
<script type="text/javascript" src="/ueditor/UE/third-party/SyntaxHighlighter/shCore.js"></script>
<script type="text/javascript" src="/ueditor/UE/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/UE/ueditor.all.min.js"></script>
<script type="text/javascript" src="/ueditor/UE/lang/zh-cn/zh-cn.js"></script>
<div class="am-form-group">
    <label for="user-intro" class="am-u-sm-3 am-form-label">商品简介</label>
    <div class="am-u-sm-9">
        <!-- <textarea name="descr" class="" rows="10" id="user-intro" placeholder="请输入商品简介"></textarea> -->
        <!-- <script id="editor" type="text/plain" style="width:100%;height:500px;"></script> -->
        <script id="editor" name="content" type="text/plain" style="height:500px;"></script>
    </div>
</div>
<a href="{% url 'myadmin_goods_edit' gid %}" class="btn btn-success">返回至编辑</a>
<a href="javascript:saveContent()" class="btn btn-info">保存内容</a>
<script type="text/javascript">
var ue = UE.getEditor('editor');

function saveContent() {
    var content = UE.getEditor('editor').getContent();
    $.ajax({
        type: 'post',
        url: '{% url "update_ueditor" gid %}',
        data: { content: content, csrfmiddlewaretoken: '{{ csrf_token }}' },
        datatype: 'json',
        success: function(req) {
            location.href = '{% url "myadmin_goods_edit" gid  %}'
        }
    })
}
SyntaxHighlighter.all();
</script>
{% endblock %}